import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';
import {promptBox, toast} from 'nc-lightapp-front';

export default function stopAgree() {
    const {json} = this.state;
    const checkedData = this.props.editTable.getCheckedRows('agreementgrid');
    if (!checkedData.length) {
        toast({color: 'warning', content: json['cm6011-000106']});
        return;
    }
    proFetch({
        url: '/nccloud/hrcm/contopinion/OpinionRemcStopEffectAgreAction.do',
        body: {
            psnpks: checkedData.map(item => item.data.values.pk_psndoc.value).join()
        }
    }).then((res) => {
        if (res.success) {
            if (res.success) {
                toast({color: 'success', content: json['cm6011-000109']});
                this.setState({
                    stopModalVisible: false,
                    stopAgreeVisible: false
                });
            }
        }
    });
}